﻿using System;
using System.Collections.Generic;

using System.Text;

namespace Acoris
{
    using System.Diagnostics;

    /// <summary>
    /// 描述一个平台无关的字体表面
    /// </summary>
    [DebuggerDisplay("{FontFamily}")]
    public sealed class FontFace
    {
        internal readonly string FontFamily;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="fontFamily"></param>
        public FontFace(string fontFamily)
        {
            if (string.IsNullOrEmpty(fontFamily))
            {

            }

            FontFamily = fontFamily;
        }

        #region Override

        /// <summary>
        /// 获取与当前对象等价的字符串形式
        /// </summary>
        /// <returns>返回与当前对象等价的字符串形式</returns>
        public override string ToString()
        {
            return FontFamily;
        }

        /// <summary>
        /// 获取当前对象与指定对象之间的等价性
        /// </summary>
        /// <param name="obj">指定要比较的对象</param>
        /// <returns>如果两个对象之间等价则返回true，否则返回false</returns>
        public override bool Equals(object obj)
        {
            if(obj is FontFace ff)
            {
                return ff.FontFamily == this.FontFamily;
            }
            return false;
        }

        /// <summary>
        /// 获取当前对象的哈希值
        /// </summary>
        /// <returns>返回当前对象的哈希值</returns>
        public override int GetHashCode()
        {
            return base.GetHashCode() ^ this.FontFamily.GetHashCode();
        }
        #endregion
    }
}
